home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / comm / bbs / cit_src_AD08.lha / ctdl.h < prev    next >
C/C++ Source or Header  |  1998-06-13  |  46KB  |  1,219 lines

  1. /*
  2. *       Ctdl.h
  3. *
  4. * #include file for all Citadel C files.
  5. * Now includes only #defines and structs.
  6. */
  7. #include "stdio.h"
  8. #include "slist.h"
  9. #include "sysdep.h"
  10. #define CTDL_HEADER     1
  11. /*
  12. *       History
  13. *
  14. * 85Oct16 HAW  Add code for OFFICE-STUFF parameter.
  15. * 85Aug29 HAW  Install code to allow double msg files for autobackup.
  16. * 85Jun19 HAW  Implant exit values so batch files can be made useful.
  17. * 85May27 HAW  Start adding networking gunk.
  18. * 85May22 HAW  MAXLOGTAB now sysop selectable.
  19. * 85May06 HAW  Add daily bailout parameter.
  20. * 85May05 HAW  Add SYSDISK parameter.
  21. * 85Mar20 HAW  Add timestamp code.
  22. * 85Feb21 HAW  Add directory names.
  23. * 85Feb20 HAW  Implement IMPERVIOUS flag.
  24. * 85Feb18 HAW  Insert global variables for baud search.
  25. * 85Jan20 HAW  Insert code to read from system clock.
  26. * 84Aug30 HAW  Begin conversion to MS-DOS.
  27. */
  28. #define NAMESIZE         20       /* length of room names                 */
  29. #define SECTSIZE        128       /* Size of a sector (XMODEM)            */
  30. #define YM_BLOCK_SIZE  1024       /* Size of a sector (YMODEM)            */
  31. typedef char label[NAMESIZE];    /* Semi-generic                         */
  32. /*
  33. * Citadel programs use readSysTab() and writeSysTab() to write an
  34. * image of the external variables in RAM to disk, and later restore
  35. * it.  The image is stored in ctdlTabl.sys .  If ctdlTabl.sys is lost,
  36. * confg.com will automatically reconstruct the hard way when invoked,
  37. * and write a new ctdlTabl.sys out when finished.  CtdlTabl.sys is
  38. * always destroyed after reading, to minimize the possibility of
  39. * reading an out-of-date version.  In general, the technique works
  40. * well and saves time and head-banging on bootup.  You should,
  41. * however, note carefully the following caution:
  42. *  o  Whenever you change the declarations in Ctdl.h you should:
  43. *   -->  destroy the current ctdlTabl.sys file
  44. *   -->  recompile and reload all citadel programs which access
  45. *        ctdlTabl.sys -- currently citadel.com & configur.com
  46. *   -->  use configur.com to build a new ctdlTabl.sys file
  47. *
  48. * If you ignore these warnings, little pixies will prick you in your
  49. * sleep for the rest of your life.
  50. */
  51. struct MiscBool
  52.   {
  53.   BOOLEAN_FLAG(HoldOnLost);   /* Save entries when carrier lost?      */
  54.   BOOLEAN_FLAG(mirror);       /* mirror msg option?                   */
  55.   BOOLEAN_FLAG(unlogEnterOk); /* TRUE if OK to enter messages anon    */
  56.   BOOLEAN_FLAG(unlogReadOk);  /* TRUE if unlogged folks can read mess */
  57.   BOOLEAN_FLAG(unlogLoginOk); /* TRUE if spontan. new accounts ok.    */
  58.   BOOLEAN_FLAG(nonAideRoomOk);/* TRUE general folks can make rooms    */
  59.   BOOLEAN_FLAG(noMail);       /* TRUE if mail is not allowed          */
  60.   BOOLEAN_FLAG(noChat);       /* TRUE if not accepting chats          */
  61.  
  62.   BOOLEAN_FLAG(netParticipant);/* TRUE if participating in the net    */
  63.   BOOLEAN_FLAG(aideSeeAll);   /* TRUE if aides see private rooms      */
  64.   BOOLEAN_FLAG(debug);        /* TRUE for debug phase                 */
  65.   BOOLEAN_FLAG(NetDft);       /* TRUE if new users get net privs      */
  66.   BOOLEAN_FLAG(SysopEditor);  /* TRUE if there is a sysop editor      */
  67.   BOOLEAN_FLAG(IsDoor);       /* TRUE if this installation is a door  */
  68.   BOOLEAN_FLAG(RouteMail);    /* TRUE if we will route mail           */
  69.   BOOLEAN_FLAG(DoorDft);      /* TRUE if new users get door privs     */
  70.  
  71.   BOOLEAN_FLAG(AnonSessions); /* TRUE if anonymous calls are recorded */
  72.   BOOLEAN_FLAG(DL_Default);   /* TRUE if new callers get dl privs     */
  73.   BOOLEAN_FLAG(NetScanBad);   /* TRUE if net msgs scanned for bad words*/
  74.   BOOLEAN_FLAG(QwkMail);      /* TRUE if we support qwk packets        */
  75.   BOOLEAN_FLAG(tdebug);       /* TRUE if special debug is turned on    */
  76.   /**
  77.     default values for when someone is not logged in, or what a
  78.     new user will get.  Values set by CONFG only.
  79.  
  80.     #DEFAULT-DATE-FORMAT  [STANDARD|LONG|SHORT]
  81.  
  82.     DFDATE     LGDATE     Display of 2000 jan 01
  83.       1          0            00JAN01  -  SHORT
  84.       1          1          2000JAN01  -  LONG
  85.       0          0           100JAN01  -  STANDARD ( default if not specified )
  86.       0          1           100JAN01  -  STANDARD
  87.   **/
  88.   BOOLEAN_FLAG(DFDATE);      /* Use default 2/3 digit date if not set */
  89.   BOOLEAN_FLAG(LGDATE);      /* full 4 digit date if set, 2 digit if not */
  90.   BOOLEAN_FLAG(unused23);     /* unused bit in the 32 bit word of flags */
  91.  
  92.   BOOLEAN_FLAG(unused24);     /* unused bit in the 32 bit word of flags */
  93.   BOOLEAN_FLAG(unused25);     /* unused bit in the 32 bit word of flags */
  94.   BOOLEAN_FLAG(unused26);     /* unused bit in the 32 bit word of flags */
  95.   BOOLEAN_FLAG(unused27);     /* unused bit in the 32 bit word of flags */
  96.   BOOLEAN_FLAG(unused28);     /* unused bit in the 32 bit word of flags */
  97.   BOOLEAN_FLAG(unused29);     /* unused bit in the 32 bit word of flags */
  98.   BOOLEAN_FLAG(unused30);     /* unused bit in the 32 bit word of flags */
  99.   BOOLEAN_FLAG(unused31);     /* unused bit in the 32 bit word of flags */
  100.   };
  101. /* Let's begin by defining the configuration struct.    */
  102. /* This is part of the contents of ctdltabl.sys         */
  103. #define MAX_DIAL_STRINGS  (7)
  104. typedef struct
  105.   {
  106.   SECTOR_ID maxMSector; /* Max # of sectors (simulated)         */
  107.   MSG_NUMBER oldest;    /* 32-bit ID# of first message in system*/
  108.   MSG_NUMBER newest;    /* 32-bit ID# of last  message in system*/
  109.   UNS_16  nodeName;   /* Offsets in codeBuf                   */
  110.   UNS_16  nodeTitle;
  111.   UNS_16  nodeId;
  112.   UNS_16  nodeDomain;   /* home domain of this installation */
  113.   UNS_16  bRoom;
  114.   UNS_16  MainFloor;    /* Main floor name                      */
  115.   UNS_16  DialPrefixes[MAX_DIAL_STRINGS], netSuffix;
  116.   NET_AREA receptArea;        /* Area to accept files sent via net here */
  117.   int  sizeArea;              /* How much room to allow for same (K)  */
  118.   int  maxFileSize;           /* In K                                 */
  119.   label SysopName;
  120.   int  cryptSeed;
  121.   UNS_16 InitColumns;
  122.   UNS_16 LoginAttempts;
  123.   char Audit;                 /* 0=none, 1=normal, 2=no net sessions  */
  124.   DependentData DepData;
  125.   char filter[128];           /* input character translation table    */
  126.   SYS_AREA homeArea,    /* Location: Help files                 */
  127.   msgArea,    /* Message file                         */
  128.   msg2Area,   /* Mirror message file                  */
  129.   logArea,    /* Log file                             */
  130.   roomArea,   /* Room file                            */
  131.   netArea,    /* Net files                            */
  132.   domainArea, /* Domain directories                   */
  133.   auditArea,  /* General auditing                     */
  134.   floorArea,  /* The floor file                       */
  135.   holdArea,   /* Held messages (lost carrier)         */
  136.   tempArea,   /* all temporary files here             */
  137.   bioArea,    /* Biographies here                     */
  138.   bannerArea, /* all banner type files here           */
  139.   QwkWorkArea,/* Current working files: Qwk Mail(unused) */
  140.   QwkName,    /* Current Qwk Packet name              */
  141.   QwkLocation,/* Current Qwk Packet Town name         */
  142.   QwkFileArea;/* Current Qwk Files area               */
  143.   char sysBaud;   /* What's our baud rate going to be?    */
  144.   UNS_16  QwkMaxRooms; /* maximum number of rooms collectable in one packet*/
  145.   UNS_16  QwkMaxPacket;/* maximum number of messages in one packet */
  146.   UNS_16  netSize;    /* How many on the net?                 */
  147.   UNS_16  DomainHandlers; /* How many domains do we service?  */
  148.   UNS_16  MailHub;    /* Who's our mail hub?      */
  149.   UNS_16  MailHubGen;   /*          */
  150.   char    DomainDisplay[11];  /* customizable display of domain names */
  151.   UNS_16 EvNumber;
  152.   /*      stuff to distinguish the various Citadel programs               */
  153.   #define CITADEL         0       /* principal program                    */
  154.   #define xxxxx           1       /* unused                               */
  155.   #define NET             2       /* network downloader                   */
  156.   #define ARCHIVER        3       /* backup program       (future)        */
  157.   #define CONFIGUR        4
  158.   #define UTILITY         5
  159.   char    weAre;              /* set first thing by main()            */
  160.   UNS_16     paramVers;
  161.   /*                      Stuff to size system with:                      */
  162.   /* WARNING!!! if you expand MAXROOMS beyond 128, horrible, horrible     */
  163.   /* things will happen to the userlog entries, which will no longer      */
  164.   /* fit in the assigned 256-byte records and will overwrite things       */
  165.   /* with normally undesirable results. 82Nov10CrT                        */
  166.   UNS_16  MAXLOGTAB,  /* number of log entries supported      */
  167.   MailSlots,
  168.   MsgsPerrm,
  169.   MaxRooms,
  170.   SharedRooms;
  171.   /*              Stuff nowadays usually in bdscio.h:                     */
  172.   /* values for functions to return: */
  173.   #define TRUE            1
  174.   #define FALSE           0
  175.   #define ERROR          -1
  176.   #define SAMESTRING      0       /* value for strcmp() & friend          */
  177.   #define PTR_SIZE        (sizeof (char *))         /* could cause problems */
  178.   /*                      Stuff for rooms:                                */
  179.   #define LOBBY           0       /* Lobby> is >always< room 0.           */
  180.   #define MAILROOM        1       /* Mail>  is >always< room 1.           */
  181.   #define AIDEROOM        2       /* Aide> is >always< room 2.            */
  182.   #define MAXCODE       800
  183.   unsigned char codeBuf[MAXCODE];/* buffer for configuration routines */
  184.   unsigned char scratch[10];  /* scratch space for config routines    */
  185.   AN_UNSIGNED shave[8];       /* shave-and-a-haircut/2 bits pauses    */
  186.   UNS_16  catChar;    /* Location of next write in msg file   */
  187.   SECTOR_ID catSector;
  188.   UNS_16  AnonMailLength; /* anonymous mail max length    */
  189.   UNS_16  sizeLTentry;  /* contains size of a logTab entry      */
  190.   UNS_16  ConTimeOut;   /* seconds in CONSOLE mode before timeout */
  191.   char sysPassword[100];      /* Remote sysop                         */
  192.   char SysopArchive[40];  /* where to archive sysop mail    */
  193.   struct MiscBool BoolFlags;  /* Buncha flags                         */
  194.  
  195.   }
  196. CONFIG;            /* And that's all of the variables we want to save */
  197. /*
  198. *       Room data
  199. */
  200. #define MAXGEN    32       /* five bits of generation=>32 of them */
  201. #define FORGET_OFFSET (MAXGEN / 2)     /* For forgetting rooms  */
  202. #define RO_OFFSET ((MAXGEN / 2) + 4) /* For r/o room write priv */
  203. /* these define what knowRoom() return */
  204. #define UNKNOWN_ROOM  0 /* user does not know of room.    */
  205. #define KNOW_ROOM 1 /* user knows room.     */
  206. #define FORGOTTEN_ROOM  2 /* user has forgotten room.   */
  207. #define WRITE_PRIVS 3 /* user has write privs in r/o room */
  208. #define DEAD_ROOM 4 /* user is looking at dead room   */
  209. #define RO  1   /* temporary for some ifdefs */
  210. #define UN_STACK        40      /* stack of rooms */
  211. #define MSG_BULK        ( MSGSPERRM * sizeof (theMessages) )
  212. #define RB_SIZE         ( sizeof(roomBuf) - (PTR_SIZE * 1) )
  213. #define RB_TOTAL_SIZE   (RB_SIZE + MSG_BULK)
  214. struct rflags
  215.   {
  216.   /* Room flags                           */
  217.   BOOLEAN_FLAG(INUSE);        /* Room in use?                         */
  218.   BOOLEAN_FLAG(PUBLIC);       /* Room public?                         */
  219.   BOOLEAN_FLAG(ISDIR);        /* Room directory?                      */
  220.   BOOLEAN_FLAG(PERMROOM);     /* Room permanent?                      */
  221.   BOOLEAN_FLAG(SKIP);         /* Room skipped? (temporary for user)   */
  222.   BOOLEAN_FLAG(UPLOAD);       /* Can room be uploaded to?             */
  223.   BOOLEAN_FLAG(DOWNLOAD);     /* Can room be downloaded from?         */
  224.   BOOLEAN_FLAG(SHARED);       /* Is this a shared room?               */
  225.   BOOLEAN_FLAG(ARCHIVE);      /* Is this room archived somewhere?     */
  226.   BOOLEAN_FLAG(ANON);         /* All messages anonymous?              */
  227.   BOOLEAN_FLAG(NO_NET_DOWNLOAD); /* Accessible via the net for download? */
  228.   BOOLEAN_FLAG(INVITE);
  229.   BOOLEAN_FLAG(AUTO_NET);
  230.   BOOLEAN_FLAG(ALL_NET);
  231.   BOOLEAN_FLAG(READ_ONLY);   /* room is read-only */
  232.   BOOLEAN_FLAG(rflag9);
  233.   BOOLEAN_FLAG(rflag10);
  234.   BOOLEAN_FLAG(rflag11);
  235.   BOOLEAN_FLAG(rflag12);
  236.   BOOLEAN_FLAG(rflag13);
  237.   BOOLEAN_FLAG(rflag14);
  238.   BOOLEAN_FLAG(rflag15);
  239.   BOOLEAN_FLAG(rflag16);
  240.   BOOLEAN_FLAG(rflag17);
  241.  
  242.   };
  243. typedef struct
  244.   {
  245.   /* The summation of a room              */
  246.   AN_UNSIGNED   rtgen;        /* generation # of room                 */
  247.   struct rflags rtflags;      /* public/private flag etc              */
  248.   label         rtname;       /* name of room                         */
  249.   MSG_NUMBER    rtlastMessage;/* # of most recent message in room     */
  250.   MSG_NUMBER    rtlastNet;    /* Highest outgoing net message         */
  251.   char          rtShareType;  /* What type of sharing for this room?  */
  252.   int           rtFlIndex;    /* Index into the floors                */
  253.  
  254.   }
  255. rTable ;                      /* And see ROOMA.C for declaration      */
  256. typedef struct
  257.   {
  258.   MSG_NUMBER rbmsgNo;     /* every message gets unique#           */
  259.   SECTOR_ID rbmsgLoc;     /* sector message starts in             */
  260.  
  261.   }
  262. theMessages;
  263. typedef struct
  264.   {
  265.   /* The appearance of a room:            */
  266.   AN_UNSIGNED   rbgen;  /* generation # of room                 */
  267.   struct rflags rbflags;  /* same bits as flags above             */
  268.   label         rbname; /* name of room                         */
  269.   ROOM_AREA     rbArea; /* area this room is attached to        */
  270.   char          rbShareType;  /* room share type                      */
  271.   UNS_16        rbFlIndex;  /* index into the floors                */
  272.   theMessages *msg;
  273.  
  274.   }
  275. aRoom ;
  276. /*
  277. *       userlog stuff
  278. */
  279. #define CRYPTADD        117    /*                                      */
  280. #define LB_SIZE         ( sizeof (logBuf) - (PTR_SIZE * 2) )
  281. #define MAIL_BULK       ( MAILSLOTS * sizeof (theMessages) )
  282. #define GEN_BULK        ( MAXROOMS * sizeof (AN_UNSIGNED) )
  283. #define LB_TOTAL_SIZE   ( LB_SIZE + MAIL_BULK + GEN_BULK )
  284. struct lflags
  285.   {
  286.   /* Flags for person in log              */
  287.   BOOLEAN_FLAG(FLOORS);       /* Unused for now                       */
  288.   BOOLEAN_FLAG(LFMASK);       /* Linefeeds?                           */
  289.   BOOLEAN_FLAG(EXPERT);       /* Expert?                              */
  290.   BOOLEAN_FLAG(AIDE);         /* Vice-Grand-Poobah?                   */
  291.   BOOLEAN_FLAG(L_INUSE);      /* Is this slot in use?                 */
  292.   BOOLEAN_FLAG(TIME);         /* Send time to user of msg creation?   */
  293.   BOOLEAN_FLAG(OLDTOO);       /* Print out last oldmessage on <N>ew?  */
  294.   BOOLEAN_FLAG(NET_PRIVS);    /* User have net privileges?            */
  295.   BOOLEAN_FLAG(RUGGIE);       /* Juvenile? Future fun-ness maybe      */
  296.   BOOLEAN_FLAG(HALF_DUP);     /* half duplex?                   */
  297.   BOOLEAN_FLAG(TWIT);         /* twit?                          */
  298.   BOOLEAN_FLAG(DOOR_PRIVS);   /* door privies?                  */
  299.   BOOLEAN_FLAG(PERMANENT);    /* permanent account?             */
  300.   BOOLEAN_FLAG(DL_PRIVS);     /* sigh                           */
  301.   BOOLEAN_FLAG(ALT_RE);       /* alternative (old-style) .RE    */
  302.   BOOLEAN_FLAG(NoPrompt);     /* message entry prompt           */
  303.   BOOLEAN_FLAG(ANSI);         /* Flag: Ansii enabled:1          */
  304.   BOOLEAN_FLAG(MSG_PAUSE);    /* Flag: Pause between msgs:1     */
  305.   /**
  306.     DF_DATE   LG_DATE     Display of 2000 jan 01
  307.       1          0            00JAN01
  308.       1          1          2000JAN01
  309.       0          0           100JAN01
  310.       0          1           100JAN01
  311.   **/
  312.   BOOLEAN_FLAG(DF_DATE);      /* Use default 2/3 digit date if not set */
  313.   BOOLEAN_FLAG(LG_DATE);      /* full 4 digit date if set, 2 digit if not */
  314.   BOOLEAN_FLAG(lflag7);
  315.   BOOLEAN_FLAG(lflag8);
  316.   BOOLEAN_FLAG(lflag9);
  317.  
  318.   };
  319. #define MAXVISIT        8       /* #visits we remember old newestLo for */
  320. #define GENSHIFT        3       /* Where the generation # is            */
  321. #define CALLMASK        7       /* For finding last visit               */
  322. typedef struct
  323.   {
  324.   /* The appearance of a user:            */
  325.   AN_UNSIGNED   lbnulls;      /* #nulls, lCase, lFeeds                */
  326.   struct lflags lbflags;      /* LFMASK, EXPERT, AIDE, INUSE, etc.    */
  327.   AN_UNSIGNED   lbwidth;      /* terminal width                       */
  328.   int           credit;       /* Credit for long distance calls       */
  329.   label         lbname;       /* caller's name                        */
  330.   label         lbpw;         /* caller's password                    */
  331.   MSG_NUMBER    lbvisit[MAXVISIT];/* newestLo for this and 7 prev. visits */
  332.   long          lblaston;     /* seconds since arbitrary date         */
  333.   AN_UNSIGNED   lbdelay;  /* milliseconds delay     */
  334.   AN_UNSIGNED   *lbgen;/* 5 bits gen, 3 bits lastvisit       */
  335.   theMessages *lbMail;
  336.  
  337.   }
  338. logBuffer ;
  339. typedef struct
  340.   {
  341.   /* Summation of a person:               */
  342.   UNS_16   ltpwhash;    /* hash of password                     */
  343.   UNS_16   ltnmhash;    /* hash of name                         */
  344.   UNS_16   ltlogSlot;   /* location in userlog.buf              */
  345.   MSG_NUMBER ltnewest;        /* last message on last call            */
  346.   char  ltpermanent;    /* permanent account?     */
  347.  
  348.   }
  349. LogTable ;                    /* And see LOG.C for declaration        */
  350. /* this is a mail forwarding structure.  Managed by slist, on   */
  351. /* disk it's known as ctdlfwd.sys.  */
  352. typedef struct
  353.   {
  354.   char *UserName;
  355.   char *System;
  356.   char *Alias;
  357.  
  358.   }
  359. ForwardMail;
  360. /*
  361. *     terminal stuff
  362. */
  363. #define SPECIAL         27      /* <ESC>        console escape char     */
  364. #define CON_NEXT        20      /* ^T           console request char    */
  365. typedef struct
  366.   {
  367.   char *unambig;              /* name of the file */
  368.   char FileDate[8];           /* yymmmdd<0>   */
  369.   long FileSize;              /* size of file */
  370.  
  371.   }
  372. DirEntry;
  373. /*
  374. *   List handling structures - specific.
  375. *   See SLIST.C for generic handling functionality
  376. */
  377. /*
  378. * This structure is used to implement the archival lists.  Each element of
  379. * this sort of list contains two things:
  380. * o The number of the room it is associated with.  There should never be more
  381. *   than one instance of this number in the list.  We should probably attempt
  382. *   to cull out duplicates.  This will be dependent on the behavior of the
  383. *   old LIBARCH code.
  384. * o The name of the file to archive to.
  385. */
  386. typedef struct
  387.   {
  388.   UNS_16 num;
  389.   UNS_16 num2;
  390.   char *string;
  391.  
  392.   }
  393. NumToString;
  394. #define CC_SIZE         140
  395. #define HasCC(x)        ((x)->mbCC.start != NULL)
  396. #define HasOverrides(x) ((x)->mbOverride.start != NULL)
  397. #define SCREEN          0
  398. #define MSGBASE         1
  399. #define TEXTFILE        2
  400. /* this is useful in events and other places */
  401. typedef struct
  402.   {
  403.   UNS_16 first;
  404.   long second;
  405.  
  406.   }
  407. TwoNumbers;
  408. /*
  409. *     message stuff
  410. */
  411. #define MAXTEXT         7500    /* maximum chars in edit buffer         */
  412. #define MAXWORD         256     /* maximum length of a word             */
  413. #define IDIOT_TRIGGER   8       /* Idiot trigger                        */
  414. #define HELD 3
  415. /* output identifications */
  416. #define WHATEVER  0 /* Everything except what we list after */
  417. #define MSGS    1 /* Msg output       */
  418. #define DL_MSGS   2 /* Download messages      */
  419. #define STATIC_MSG_SIZE (sizeof msgBuf - (sizeof msgBuf.mbCC + sizeof msgBuf.mbOverride + sizeof msgBuf.mbtext + sizeof msgBuf.mbInternal + sizeof msgBuf.mbForeign))
  420. #define MoveMsgBuffer(x, y)     memcpy(x, y,(long)(sizeof *x) - PTR_SIZE),(y)->mbForeign.start = (y)->mbCC.start = (y)->mbOverride.start = NULL,strCpy((x)->mbtext, (y)->mbtext);
  421. #define O_NET_PATH_SIZE         100
  422. typedef struct
  423.   {
  424.   /* This is what a msg looks like        */
  425.   int  mbheadChar       ;     /* start of message                     */
  426.   SECTOR_ID     mbheadSector; /* start of message                     */
  427.   char  mbauth[129];    /* name of author                       */
  428.   label mbdate ;    /* creation date                        */
  429.   label mbtime ;    /* creation time                        */
  430.   label mbId   ;    /* local number of message              */
  431.   label mboname;    /* short human name for origin system   */
  432.   label mborig ;    /* US xxx xxx xxxx style ID             */
  433.   label mbroom ;    /* creation room                        */
  434.   label mbsrcId;    /* message ID on system of origin       */
  435.   char  mbto[129];    /* private message to                   */
  436.   char  mbaddr[(NAMESIZE * 2) + 10];/* address of system for net routing    */
  437.   char  mbOther[O_NET_PATH_SIZE];/* OtherNet address                  */
  438.   label mbreply;    /* reply pointer -- Mail only   */
  439.   label mbdomain;   /* home domain of message   */
  440.   SListBase mbCC;   /* lists of CC type people              */
  441.   SListBase mbOverride; /* for overriding the mbto field        */
  442.   SListBase mbInternal; /* for overriding the mbto field        */
  443.   SListBase mbForeign;  /* list of foreign fields   */
  444.   char  *mbtext;    /* buffer text is edited in             */
  445.  
  446.   }
  447. MessageBuffer;
  448. /* values for showMess routine */
  449. #define NEWoNLY         0
  450. #define OLDaNDnEW       1
  451. #define OLDoNLY         2
  452. #define GLOBALnEW       3
  453. #define PHRASE_SIZE     50
  454. typedef struct
  455.   {
  456.   SListBase Users;
  457.   /* char  System[(2 * NAMESIZE) + 10]; */
  458.   char  Phrase[PHRASE_SIZE];
  459.   long  Date;
  460.   char  LocalOnly;
  461.  
  462.   }
  463. OptValues;
  464. /* definitions for determination of net message display */
  465. #define ALL_MESSAGES    0
  466. #define LOCAL_ONLY      1
  467. struct mBuf
  468.   {
  469.   DATA_BLOCK    sectBuf;
  470.   int           thisChar;
  471.   SECTOR_ID     thisSector;
  472.   int           oldChar;
  473.   SECTOR_ID     oldSector;
  474.  
  475.   };
  476. typedef struct
  477.   {
  478.   MSG_NUMBER ltnewest;        /* last message on last call            */
  479.   SECTOR_ID  loc;
  480.  
  481.   }
  482. CheckPoint;
  483. #define CHECKPT   "chkpt"
  484. /*
  485. *     modem stuff
  486. */
  487. #define NEWCARRIER   0x01       /* returned to main prog on login       */
  488. #define CPT_SIGNAL      18      /* ^R                                   */
  489. #define MODEM           0       /* current user of system is            */
  490. #define CONSOLE         1       /* one of these                         */
  491. /*  output XON/XOFF etc flag... */
  492. #define OUTOK           0       /* normal output                        */
  493. #define OUTPAUSE        1       /* a pause has been requested           */
  494. #define OUTNEXT         2       /* quit this message, get the next      */
  495. #define OUTSKIP         3       /* stop current process                 */
  496. #define OUTPARAGRAPH    4       /* skip to next paragraph               */
  497. #define IMPERVIOUS      5       /* make current output unstoppable      */
  498. #define NET_CALL        6       /* net call detected - only banner      */
  499. #define STROLL_DETECTED 7       /* net call detected - only banner      */
  500. #define NEITHER         0       /* don't echo input at all              */
  501. #define CALLER          1       /* echo to caller only --passwords etc  */
  502. #define BOTH            2       /* echo to caller and console both      */
  503. /* These are bit flags passed to string input functions */
  504. #define NO_ECHO         0x01  /* Echo input as X's                    */
  505. #define BS_VALID  0x02  /* return BS_RETURN on BS at zero */
  506. #define QUEST_SPECIAL 0x04  /* question mark is special?    */
  507. #define CR_ON_ABORT 0x08  /* question mark is special?    */
  508. #define TWICE   2 /* for MenuList() - icky kludge   */
  509. /* this is for command acquisition intelligence */
  510. #define TERM  "\001"
  511. #define NTERM "\002"
  512. /* return values for command acquisition */
  513. #define BACKED_OUT  0
  514. #define BAD_SELECT  1
  515. #define GOOD_SELECT 2
  516. /* message manipulation values */
  517. #define NO_CHANGE 0
  518. #define DELETED   1
  519. #define NETTED    2
  520. /* Result code defines, to be returned by system dependent functions */
  521. #define R_300           0
  522. #define R_1200          1
  523. #define R_2400          2
  524. #define R_4800          3
  525. #define R_9600          4
  526. #define R_14400         5
  527. #define R_19200         6
  528. #define R_38400         7
  529. #define R_57600         8
  530. #define R_RING          9
  531. #define R_DIAL         10
  532. #define R_NODIAL       11
  533. #define R_AOK          12
  534. #define R_NOCARR       13
  535. #define R_BUSY         14
  536. /*
  537. *     event stuff
  538. */
  539. #define SUNDAYS         1
  540. #define MONDAYS         2
  541. #define TUESDAYS        4
  542. #define WEDNESDAYS      8
  543. #define THURSDAYS       16
  544. #define FRIDAYS         32
  545. #define SATURDAYS       64
  546. #define ALL_DAYS        127     /* 0x7F */
  547. /* event types */
  548. #define TYPREEMPT       0
  549. #define TYNON           1
  550. #define TYQUIET         2
  551. /* event classes */
  552. #define CLNET           0
  553. #define CLEXTERN        1
  554. #define CLREL           2
  555. #define CL_DL_TIME      3
  556. #define CL_ANYTIME_NET  4
  557. #define CL_DOOR_TIME    5
  558. #define CL_AUTODOOR     6
  559. #define CL_CHAT_ON  7
  560. #define CL_CHAT_OFF 8
  561. #define CL_REDIRECT 9
  562. #define CL_NEWUSERS_ALLOWED 10
  563. #define CL_NEWUSERS_DISALLOWED  11
  564. #define CL_UNTIL_NET  12
  565. #define CL_NETCACHE 13
  566. /* number of event classes supported */
  567. #define EVENT_CLASS_COUNT 14
  568. #define ALL_NETS        ~(0l)
  569. #define MAX_NET         32
  570. #define NO_NETS         0l
  571. #define PRIORITY_MAIL (1l << 31)
  572. typedef struct
  573.   {
  574.   int            EvDur,               /* Event duration       */
  575.   EvWarn;              /* Event warning pointer*/
  576.   unsigned char  EvClass,             /* Event Class          */
  577.   EvType;              /* Event Type           */
  578.   MULTI_NET_DATA EvExitVal;           /* Event Exit value     */
  579.   UNS_16         EvMinutes;           /* From midnight        */
  580.   union
  581.     {
  582.     struct
  583.       {
  584.       long       EvDeadTime;      /* Anytime netting      */
  585.       int        EvAnyDur;        /* Anytime netting      */
  586.  
  587.       }
  588.     Anytime;
  589.     label      EvUserName;          /* Autodoor target acct */
  590.     struct
  591.       {
  592.       /* Redirect incoming  */
  593.       label EvSystem;   /* Valid system   */
  594.       char  EvFilename[MAX_FILENAME]; /* incoming file */
  595.       int   EvHomeDir;    /* points into codeBuf  */
  596.  
  597.       }
  598.     Redirect;
  599.  
  600.     }
  601.   vars;
  602.  
  603.   }
  604. EVENT;
  605. /*
  606. * net stuff
  607. */
  608. /* SYSBAUD constants    */
  609. #define ONLY_300        0       /* 300 baud only                        */
  610. #define BOTH_300_1200   1       /* +1200 baud                           */
  611. #define TH_3_12_24      2       /* +2400 baud                           */
  612. #define B_4             3       /* +4800 baud                           */
  613. #define B_5             4       /* +9600 baud                           */
  614. #define B_6             5       /* 14400 baud                           */
  615. #define B_7             6       /* 19200 baud                           */
  616. #define B_8             7       /* 38400 baud                           */
  617. #define B_9             8       /* 57600 baud                           */
  618. /* ITL constants        */
  619. #define ITL_SUCCESS     0
  620. #define ITL_BAD_TRANS   1
  621. #define ITL_NO_OPEN     2
  622. /* Network request codes        */
  623. #define HANGUP          0       /* Terminate networking                 */
  624. #define NORMAL_MAIL     1       /* Send normal Mail                     */
  625. #define R_FILE_REQ      2       /* Request a single file                */
  626. #define A_FILE_REQ      3       /* Request a number of files            */
  627. #define NET_ROOM        5       /* Send a shared room                   */
  628. #define CHECK_MAIL      6       /* Check for recipient validity         */
  629. #define SEND_FILE       7       /* Send a file to another system        */
  630. #define NET_ROUTE_ROOM  8       /* Send a routed shared room            */
  631. #define ROUTE_MAIL      9       /* Send route mail                      */
  632. #define ITL_COMPACT 10  /* Compact messages during transfer */
  633. #define FAST_MSGS 21  /* Mass transfer      */
  634. #define ITL_PROTOCOL    100     /* Switch to different protocol         */
  635. #define ROLE_REVERSAL   201     /* Reverse roles                        */
  636. #define SYS_NET_PWD     202     /* System password stuff                */
  637. #define BAD             0       /* Reply Codes: this indicates bad      */
  638. #define GOOD            1       /* And this indicates good              */
  639. /* These refer to negative ack mail     */
  640. #define NO_ERROR        0       /* No error (ends transmission)         */
  641. #define NO_RECIPIENT    1       /* No recipient found                   */
  642. #define BAD_FORM        2       /* Something's wrong                    */
  643. #define UNKNOWN         99      /* Something's REALLY wrong (eek!)      */
  644. #define PEON            0
  645. #define REG_HOST        1
  646. #define BACKBONE        2       /* Kinda like a hub     */
  647. #define PASS_BACKBONE   3       /* Used in "mode" only, not rbSharedType */
  648. #define ACTIVE_BACKBONE 4
  649. /* These used with ITL_PROTOCOL command         */
  650. #define XM_ITL          "0"
  651. #define YM_ITL          "1"
  652. #define WXM_ITL         "2"
  653. /* These are used with ITL_COMPACT command  */
  654. #define COMPACT_1 "0"
  655. #define NET_GEN         32
  656. #define NON_NET   0
  657. #define NORMAL_NET  1
  658. #define ANYTIME_NET 2
  659. #define ANY_CALL  3
  660. #define STROLL_CALL 4       /* net call detected - only banner      */
  661. #define UNTIL_NET 5
  662. #define NET_CACHE 6
  663. #define NOT_SYSTEM      0
  664. #define BAD_FORMAT      1
  665. #define NO_SYSTEM       2
  666. #define IS_SYSTEM       3
  667. #define SYSTEM_IS_US  4
  668. /* domain function responses  */
  669. #define REFUSE    0
  670. #define OURS    1
  671. #define LOCALROUTE  2
  672. #define DOMAINFILE  3
  673. /* domain file upload results */
  674. #define DOMAIN_SUCCESS  0
  675. #define DOMAIN_FAILURE  1
  676. /* route mail send errors */
  677. #define NO_SUCH_FILE  0
  678. #define REFUSED_ROUTE 1
  679. #define GOOD_SEND 2
  680. #define UNKNOWN_ERROR 3
  681. /* netController() flag values -- OR these values together */
  682. #define REPORT_FAILURE  0x01
  683. #define LEISURELY 0x02
  684. /*
  685. * this structure is the flags attached to a node
  686. */
  687. struct nflags
  688.   {
  689.   /* Any and all reasons to call this node*/
  690.   BOOLEAN_FLAG(normal_mail);  /* Outgoing normal mail?                */
  691.   BOOLEAN_FLAG(in_use);       /* Is this record even in use?          */
  692.   BOOLEAN_FLAG(room_files);   /* Any file requests?                   */
  693.   BOOLEAN_FLAG(local);        /* Is this node local?                  */
  694.   BOOLEAN_FLAG(spine);        /* Will we be a spine?                  */
  695.   BOOLEAN_FLAG(send_files);
  696.   BOOLEAN_FLAG(is_spine);     /* Is that system a spine?              */
  697.   BOOLEAN_FLAG(OtherNet);
  698.   BOOLEAN_FLAG(HasRouted);
  699.   BOOLEAN_FLAG(RouteFor);
  700.   BOOLEAN_FLAG(RouteTo);
  701.   BOOLEAN_FLAG(Stadel);
  702.   BOOLEAN_FLAG(RouteLock);
  703.   BOOLEAN_FLAG(ExternalDialer);
  704.   BOOLEAN_FLAG(NoDL);
  705.   BOOLEAN_FLAG(MassTransfer);
  706.   BOOLEAN_FLAG(Zip);             /* Amiga update */
  707.   BOOLEAN_FLAG(Zoo);
  708.   BOOLEAN_FLAG(Arc);
  709.   BOOLEAN_FLAG(Lha);
  710.  
  711.   };
  712. #define CGetMode(x)  ((x) & 7)
  713. #define CSetMode(x, y) x = (x & (~7)) + y;
  714. #define GetFA(x)  ((x) & 8)
  715. #define SetFA(x)  x |= 8;
  716. #define UnSetFA(x)  x &= (~8);
  717. #define CACHE_END_NAME    "%d.msg"
  718. #define V_CACHE_END_NAME  "v%d.msg"
  719. #define RECOVERY_FILE "incase.net"
  720. #define FAST_TRANS_FILE "\001\002\003"
  721. typedef struct
  722.   {
  723.   char        *addr1, *addr2, *addr3;
  724.   MSG_NUMBER  HiSent;
  725.   int (*sendfunc)(int x);
  726.  
  727.   }
  728. NetInfo;
  729. typedef struct
  730.   {
  731.   MSG_NUMBER lastMess;        /* Highest net message in this room     */
  732.   unsigned   srgen;           /* High bit of gen is used flag         */
  733.   unsigned   srslot;
  734.   int        mode;    /* low 3 bits is mode, fourth bit tells */
  735.   /* if there's a file of msgs to send  */
  736.  
  737.   }
  738. SharedRoom;
  739. #define NT_SIZE         (sizeof (*netTab) - (PTR_SIZE))
  740. #define NB_SIZE         (sizeof (netBuf)  - (PTR_SIZE))
  741. #define SR_BULK         (SHARED_ROOMS * sizeof (SharedRoom))
  742. #define NT_TOTAL_SIZE   (NT_SIZE + SR_BULK)
  743. #define NB_TOTAL_SIZE   (NB_SIZE + SR_BULK)
  744. typedef struct
  745.   {
  746.   label          netId;       /* Node id      */
  747.   label          netName;     /* Node name    */
  748.   char           nbShort[3];  /* short hand */
  749.   label          OurPwd;
  750.   label          TheirPwd;
  751.   MULTI_NET_DATA MemberNets;
  752.   struct nflags  nbflags;     /* Flags        */
  753.   char           baudCode;    /* Baud code for this node   */
  754.   char           nbGen;       /* Generation value for this node */
  755.   char           access[40];  /* For alternative access       */
  756.   int      nbRoute;     /* what system do we route via? */
  757.   UNS_16     nbRouteGen;     /* what system do we route via? */
  758.   UNS_16     nbHiRouteInd;        /* internal housekeeping        */
  759.   unsigned long  nbLastConnect; /* last connection with this system */
  760.   SharedRoom *netRooms;
  761.  
  762.   }
  763. NetBuffer;
  764. typedef struct
  765.   {
  766.   int            ntnmhash;
  767.   int            ntidhash;
  768.   char           ntShort[3];
  769.   struct nflags  ntflags ;
  770.   MULTI_NET_DATA ntMemberNets;
  771.   char           ntGen;
  772.   SharedRoom     *netTRooms;
  773.  
  774.   }
  775. NetTable;
  776. struct cmd_data
  777.   {
  778.   /* Commands for networking              */
  779.   AN_UNSIGNED command;
  780.   char        fields[4][NAMESIZE];
  781.  
  782.   };
  783. struct netMLstruct
  784.   {
  785.   MSG_NUMBER ML_id;
  786.   SECTOR_ID  ML_loc;
  787.  
  788.   };
  789. struct fl_req
  790.   {
  791.   label room;
  792.   label roomfile;
  793.   NET_AREA flArea;
  794.   label filename;
  795.  
  796.   };
  797. struct fl_send
  798.   {
  799.   NET_AREA snArea;
  800.   label sFilename;
  801.  
  802.   };
  803. /*
  804. * Error values for reasons on not sharing
  805. */
  806. #define NO_ROOM   0
  807. #define NOT_SHARING 1 /* not a shared room */
  808. #define NOT_SHARED  2 /* not sharing with you */
  809. #define NO_PWD    3
  810. #define FOUND   4
  811. typedef struct
  812.   {
  813.   label Room;   /* this is the target */
  814.   char  virtual;  /* the rest contains results */
  815.   int   room;
  816.   int   index;
  817.   char  reason;
  818.  
  819.   }
  820. RoomSearch;
  821. /*
  822. *     Floor data structures
  823. */
  824. /* Display modes for floor summaries    */
  825. #define INT_EXPERT      0       /* First display for experts            */
  826. #define INT_NOVICE      1       /* First display for novices            */
  827. #define ONLY_FLOORS     2       /* Floors only, no rooms 'tall.         */
  828. #define NOT_INTRO       3       /* 'K' is done.                         */
  829. #define FORGOTTEN       4       /* Forgotten rooms list                 */
  830. #define MATCH_SEL       10
  831. #define DR_SEL          11
  832. #define SH_SEL          12
  833. #define PR_SEL          13
  834. #define ANON_SEL        14
  835. #define READONLY        15
  836. #define ARCH_SEL        16
  837. struct floor
  838.   {
  839.   label FlName;
  840.   char  FlInuse;
  841.   label FlModerator;
  842.  
  843.   };
  844. /*
  845. *     Exit values for errorlevels
  846. */
  847. #define SYSOP_EXIT              0        /* "Normal"     */
  848. #define RECURSE_EXIT            1
  849. #define CRASH_EXIT              2
  850. #define REMOTE_SYSOP_EXIT       3
  851. #define DOOR_EXIT               4
  852. /*
  853. *     Useful psuedo functions
  854. */
  855. #define onLine()        (haveCarrier    ||   onConsole)
  856. #define wrNetId(x)      ((strCmpU(x, ALL_LOCALS) != 0) ? x : WRITE_LOCALS)
  857. #define putMLNet(f,b)   if (fwrite(&b, sizeof(b), 1, f) != 1)\
  858. crashout("putMLNet crash")
  859. #define getMLNet(f,b)   (fread(&b, sizeof(b), 1, f) == 1)
  860. #define putSLNet(b, f)  if (fwrite(&b, sizeof(b), 1, f) != 1)\
  861. crashout("putSLNet crash")
  862. #define getSLNet(b, f)  (fread(&b, sizeof(b), 1, f) == 1)
  863. #define TheSysop()      (aide && strCmpU(cfg.SysopName, logBuf.lbname) == SAMESTRING && onConsole)
  864. #define SomeSysop()     (TheSysop() || (remoteSysop && strCmpU(cfg.SysopName, logBuf.lbname) == SAMESTRING))
  865. #define HalfSysop()     (aide && (remoteSysop || onConsole))
  866. #define setNeedsProcessing(i)   netBuf.netRooms[i].srslot |= 0x8000
  867. #define chkNeedsProcessing(i)   (netBuf.netRooms[i].srslot & 0x8000)
  868. #define resetNeedsProcessing(i) netBuf.netRooms[i].srslot &= 0x7FFF
  869. #define isSharedRoom(h, i)      (netTab[h].netTRooms[i].srgen & 0x8000)
  870. #define resetNetRoomFlag(i)     netBuf.netRooms[i].srgen &= 0x7FFF;\
  871. netTab[thisNet].netTRooms[(i)].srgen &= 0x7FFF;
  872. #define netRoomSlot(i)          (netBuf.netRooms[i].srslot & 0x7FFF)
  873. #define netTabRoomSlot(h, i)    (netTab[h].netTRooms[i].srslot & 0x7FFF)
  874. #define netGen(h, i)            (netTab[h].netTRooms[i].srgen & 0x7FFF)
  875. #define roomValidate(h, i)  (roomTab[netTabRoomSlot(h, i)].rtgen==netGen(h,i) \
  876. && roomTab[netTabRoomSlot(h, i)].rtflags.INUSE \
  877. && roomTab[netTabRoomSlot(h, i)].rtflags.SHARED)
  878. #define INTERVALS 8             /* Half second intervals                */
  879. #define minimum(x,y)    ((x) < (y) ? (x) : (y))
  880. /* #define max(x,y)        ((x) > (y) ? (x) : (y)) */
  881. #define initLogBuf(x)   (x)->lbgen = (AN_UNSIGNED *) GetDynamic(GEN_BULK),\
  882.                         (x)->lbMail = (theMessages *)GetDynamic(MAIL_BULK)
  883. #define killLogBuf(x)   free((x)->lbgen), free((x)->lbMail)
  884.  
  885. #define initRoomBuf(x)  (x)->msg = (theMessages *)GetDynamic(max(MAIL_BULK, MSG_BULK))
  886.  
  887. #define killRoomBuf(x)  free((x)->msg)
  888. #define initNetBuf(x)   (x)->netRooms = (SharedRoom *)GetDynamic(sizeof (*(x)->netRooms) * SHARED_ROOMS)
  889. #define killNetBuf(x)   free((x)->netRooms)
  890. #define NumElems(x)     (sizeof (x)) / (sizeof (x[0]))
  891. #define copyLogBuf(x, y)  memcpy(y, x, LB_SIZE),\
  892.                           memcpy((y)->lbMail, (x)->lbMail, (long)MAIL_BULK),\
  893.                           memcpy((y)->lbgen, (x)->lbgen, (long)GEN_BULK)
  894. #define HasPriorityMail(n)  (netTab[n].ntMemberNets & PRIORITY_MAIL)
  895. extern int ClassActive[];
  896. #define Dl_Limit_On()   (ClassActive[CL_DL_TIME])
  897. #define Door_Limit_On() (ClassActive[CL_DOOR_TIME])
  898. extern char **ValidMenuOpts, *Menu;
  899. #define RegisterThisMenu(x, y)      Menu = x, ValidMenuOpts = y;
  900. #define NodeDisabled(x) (!(netTab[x].ntMemberNets & ALL_NETS))
  901. #define CompExtension(CompType)    Formats[(CompType) - 1].Format
  902. /*
  903. *     Call log stuff
  904. */
  905. #define BAUD            0       /* This message concerns baud rate      */
  906. #define L_IN            1       /*  "      "       "     login          */
  907. #define L_OUT           2       /*  "      "       "     logout         */
  908. #define CARRLOSS        3       /*  "      "       "     carr-loss      */
  909. #define FIRST_IN        4       /*  "      "       "     init           */
  910. #define LAST_OUT        5       /*  "      "       "     close-down     */
  911. #define EVIL_SIGNAL     6       /*  "      "       "     user errors    */
  912. #define CRASH_OUT       7       /*  "      "       "     crash down     */
  913. #define INTO_NET        8       /*  "      "       "     net entry      */
  914. #define OUTOF_NET       9       /*  "      "       "     net exit       */
  915. #define DOOR_RETURN     10      /*  "      "       "     door returns   */
  916. #define DOOR_OUT        11      /*  "      "       "     door exits     */
  917. #define BADWORDS_SIGNAL 12      /*  "      "       "     bad words      */
  918. #define TRIED_CHAT      13      /*  "      "       "     chat attempts  */
  919. #define FL_START        0       /* starting a file transfer             */
  920. #define FL_FAIL         1       /* file transfer failed                 */
  921. #define FL_SUCCESS      2       /* file transfer success                */
  922. #define FL_EX_END       3       /* external file transfer finish        */
  923. /*
  924. *     Transfer protocol constants
  925. */
  926. #define ASCII           0
  927. #define XMDM            1
  928. #define YMDM            2
  929. #define WXMDM           3
  930. #define TOP_PROTOCOL  WXMDM
  931. #define InternalProtocol(x) (x >= 0 && x <= TOP_PROTOCOL)
  932. #define MAX_WX_ERRORS   10
  933. #define ERRORMAX        10       /* How many errors to suffer through   */
  934. #define RETRYMAX        10
  935. #define MINUTE          60       /* How long is a minute?               */
  936. #define STARTUP         1        /* Code to start a transfer            */
  937. #define FINISH          2        /* Code to cleanup a transfer          */
  938. /* Reception startup error values */
  939. #define TRAN_SUCCESS    0       /* Successful transfer                  */
  940. #define NO_LUCK         1       /* Never return this to caller          */
  941. #define CANCEL          2       /* Session encountered a CAN            */
  942. #define NO_START        3       /* Transfer never even started!         */
  943. #define TRAN_FAILURE    4       /* Something blew...                    */
  944. /* Internally used values, not returned to caller       */
  945. #define NO_ERROR        0
  946. #define BAD_DLE         1
  947. #define EARLY_SYN       2
  948. #define DATA_TIMEOUT    3
  949. #define BAD_CRC         4
  950. #define BAD_CKSM        5
  951. #define BAD_SEC_COMP    6
  952. #define SYNCH_ERROR     7       /* Fatal */
  953. #define WRITE_ERROR     8       /* Fatal */
  954. #define CARR_LOSS       9       /* Fatal */
  955. /* Internal WXMODEM enumerations for transmission window */
  956. #define NOT_USED        0
  957. #define SECTOR_READY    1
  958. #define SENT            2
  959. #define ACKED           3
  960. /* ASCII characters: */
  961. #define SOH             1
  962. #define STX             2
  963. #define CNTRLC          3
  964. #define CNTRLD          4      /* control D character */
  965. #define EOT             4
  966. #define ETX   3
  967. #define ACK             6
  968. #define BELL            7
  969. #define BACKSPACE       8
  970. #define CNTRLI          9       /* aka tab                              */
  971. #define TAB             9       /* aka ^I                               */
  972. #define NEWLINE        10       /* "linefeed" to philistines.           */
  973. #define CNTRLl         12       /* Sysop privileges                     */
  974. #define CNTRLO         15
  975. #define DLE            16
  976. #define XON            17
  977. #define XOFF           19       /* control-s                            */
  978. #define NAK            21
  979. #define SYN            22
  980. #define CAN            24
  981. #define CNTRLZ         26
  982. #define CPMEOF     CNTRLZ
  983. #define ESC            27       /* altmode                              */
  984. #define CRC_START     'C'       /* CRC Mode for WC                      */
  985. #define DEL          0x7F       /* delete char                          */
  986. #define IS_NUMEROUS     0x01
  987. #define IS_DL           0x02
  988. #define NEEDS_FIN       0x04
  989. #define RIGAMAROLE      0x08
  990. #define NOT_AVAILABLE   0x10
  991. #define NEEDS_HDR       0x20    /* True only for file transfer          */
  992. typedef struct
  993.   {
  994.   char *GenericName;
  995.   UNS_16  KludgeFactor;
  996.   UNS_16  flags;                 /* Bit map - see above */
  997.   char *name;
  998.   char *MsgTran;
  999.   char *BlbName;
  1000.   char *UpBlbName;
  1001.   int  (*method)(int c);
  1002.   UNS_16 BlockSize;
  1003.   int  (*SendHdr)(long fileSize, char *fileName);
  1004.   int  (*CleanUp)(void);
  1005.  
  1006.   }
  1007. PROTO_TABLE;
  1008. typedef struct
  1009.   {
  1010.   UNS_16 ThisBlock;      /* Block # of this block */
  1011.   AN_UNSIGNED *buf;
  1012.   CRC_TYPE ThisCRC;        /* So we only calculate once */
  1013.   char status;        /* Init these to NOT_USED */
  1014.  
  1015.   }
  1016. TransferBlock;
  1017. #define NORMAL          0
  1018. #define DISK            1
  1019. /*
  1020. * Compression types for use in netting
  1021. */
  1022. #define NO_COMP   -1
  1023. #define LHA_COMP  1
  1024. #define ZIP_COMP  2
  1025. #define ZOO_COMP  3
  1026. #define ARC_COMP  4
  1027. #define COMP_MAX  ARC_COMP
  1028. /*
  1029. * Protocols for Mass Transfers
  1030. */
  1031. #define DEFAULT_PROTOCOL  -1
  1032. #define XM_PROTOCOL   0
  1033. #define YM_PROTOCOL   1
  1034. #define WX_PROTOCOL   2
  1035. #define ZM_PROTOCOL   3
  1036. /*
  1037. * Table for decoding funny files
  1038. */
  1039. typedef struct
  1040.   {
  1041.   char *Format;
  1042.   char Many;
  1043.   char (*Func)(FILE *fd, ...);
  1044.  
  1045.   }
  1046. FunnyInfo;
  1047. extern FunnyInfo Formats[];
  1048. /*
  1049. *     SEA ARC reading structure
  1050. */
  1051. typedef struct
  1052.   {
  1053.   char   ArchiveMark;
  1054.   char   Header;
  1055.   char name [13];     /* file name */
  1056.   UNS_32 size;        /* size of compressed file */
  1057.   UNS_16 date;        /* file date*/
  1058.   UNS_16 time;        /* file time */
  1059.   UNS_16 crc;         /* cyclic redundancy check */
  1060.   UNS_32 length;      /* true file length */
  1061.  
  1062.   }
  1063. ARCbuf;
  1064. /*
  1065. *     PK ZIP header structure
  1066. */
  1067. typedef struct
  1068.   {
  1069.   UNS_32 Signature;
  1070.   UNS_16 ExtVersion;
  1071.   UNS_16 BitFlags;
  1072.   UNS_16 Method;
  1073.   UNS_16 FileTime;
  1074.   UNS_16 FileDate;
  1075.   UNS_32 CRC;
  1076.   UNS_32 CompSize;
  1077.   UNS_32 NormalSize;
  1078.   UNS_16 NameLength;
  1079.   UNS_16 FieldLength;
  1080.  
  1081.   }
  1082. ZipHeader;
  1083. /*
  1084. *     ZOO header information
  1085. * These structures were taken directly from Rahul Dhesi's code
  1086. * and are under his copyright.
  1087. */
  1088. #define SIZ_TEXT  20                   /* Size of header text */
  1089. #define FNAMESIZE 13                   /* Size of DOS filename */
  1090. #define LFNAMESIZE 256                 /* Size of long filename */
  1091. #define PATHSIZE 256                   /* Max length of pathname */
  1092. typedef struct
  1093.   {
  1094.   char text[SIZ_TEXT];
  1095.   UNS_32 zoo_tag;
  1096.   UNS_32 zoo_start;
  1097.   UNS_32 zoo_minus;
  1098.   char major_ver;
  1099.   char minor_ver;
  1100.   char type;
  1101.   UNS_32 acmt_pos;
  1102.   UNS_16 acmt_len;
  1103.   UNS_16 vdata;
  1104.  
  1105.   }
  1106. zoo_header;
  1107. typedef struct
  1108.   {
  1109.   UNS_32 zoo_tag;
  1110.   char type;
  1111.   char packing_method;
  1112.   UNS_32 next;
  1113.   UNS_32 offset;
  1114.   UNS_16 date;
  1115.   UNS_16 time;
  1116.   UNS_16 file_crc;
  1117.   UNS_32 org_size;
  1118.   UNS_32 size_now;
  1119.   char major_ver;
  1120.   char minor_ver;
  1121.   char deleted;
  1122.   char struc;
  1123.   UNS_32 comment;
  1124.   UNS_16 cmt_size;
  1125.   char fname[FNAMESIZE];
  1126.   UNS_16 var_dir_len;
  1127.   char tz;
  1128.   UNS_16 dir_crc;
  1129.   /* fields for variable part of directory entry follow */
  1130.   char namlen;
  1131.   char dirlen;
  1132.   char lfname[LFNAMESIZE];
  1133.   char dirname[PATHSIZE];
  1134.   UNS_16 system_id;
  1135.   UNS_32 fattr;
  1136.   UNS_16 vflag;
  1137.   UNS_16 version_no;
  1138.  
  1139.   }
  1140. zoo_direntry;
  1141. /*
  1142. *     LHA structure information
  1143. *     courtesy Daniel Durbin
  1144. */
  1145. typedef struct
  1146.   {
  1147.   /* Local file header */
  1148.   char unknown1[2];   /* ? */
  1149.   char method[5];     /* compression method */
  1150.   UNS_32 csize;     /* compressed size */
  1151.   UNS_32 fsize;     /* uncompressed size */
  1152.   UNS_16 ftime;     /* last mod file time (msdos format) */
  1153.   UNS_16 fdate;     /* last mod file date */
  1154.   char fattr;     /* file attributes */
  1155.   char unknown2;      /* ? */
  1156.   char namelen;     /* filename length */
  1157.  
  1158.   }
  1159. LZHead;
  1160. /*
  1161. *     Gif header information
  1162. */
  1163. typedef struct
  1164.   {
  1165.   char   Sig[6];  /* no null */
  1166.   UNS_16 Width;
  1167.   UNS_16 Height;
  1168.   char   Colors;
  1169.  
  1170.   }
  1171. GifHeader;
  1172. /*
  1173. *     Timer Assignments
  1174. */
  1175. #define WORK_TIMER      0       /* scratch timer        */
  1176. #define NEXT_ANYNET     1
  1177. #define USER_TIMER      2
  1178. #define NET_SESSION     3
  1179. /*
  1180. *     Multi-tasking (OS) defines
  1181. */
  1182. #define INUSE_PAUSE 0
  1183. #define IDLE_PAUSE  1
  1184. #define NET_PAUSE 2
  1185. #define CHAT_NICE 3
  1186. /*
  1187. *     Data Entry Types
  1188. */
  1189. #define MSG_ENTRY 0
  1190. #define FILE_ENTRY  1
  1191. #define INFO_ENTRY  2
  1192. #define BIO_ENTRY 3
  1193. /*
  1194. *     Finger saving defines
  1195. */
  1196. #define termWidth       logBuf.lbwidth
  1197. #define termNulls       logBuf.lbnulls
  1198. #define termLF          logBuf.lbflags.LFMASK
  1199. #define expert          logBuf.lbflags.EXPERT
  1200. #define aide            logBuf.lbflags.AIDE
  1201. #define sendTime        logBuf.lbflags.TIME
  1202. #define oldToo          logBuf.lbflags.OLDTOO
  1203. #define FloorMode       logBuf.lbflags.FLOORS
  1204. #define HalfDup         logBuf.lbflags.HALF_DUP
  1205. #define thisFloor       roomBuf.rbFlIndex
  1206. #define DoorPriv        logBuf.lbflags.DOOR_PRIVS
  1207. #define MAILSLOTS       cfg.MailSlots
  1208. #define MSGSPERRM       cfg.MsgsPerrm
  1209. #define MAXROOMS        cfg.MaxRooms
  1210. #define SHARED_ROOMS    cfg.SharedRooms
  1211. /*
  1212. * This is icky, and should be a lesson to all would-be
  1213. * header writers.
  1214. */
  1215. #include "ctdlvirt.h"
  1216. #include "ctdlansi.h"
  1217. #include "ansisys.h"
  1218. /* And that's it for this file */
  1219.